home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / Views.fr < prev   
Encoding:
Text File  |  1996-08-16  |  5.5 KB  |  185 lines  |  [TEXT/BROW]

  1. //========================================================================================
  2. //
  3. //    File:                Views.fr
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Contains:            Common (Platform independent) resources for the Draw part
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef FWRESFIL_K
  13. #include "FWResFil.k"
  14. #endif
  15.  
  16. #ifndef FWVIEWS_FR
  17. #include "FWViews.fr"
  18. #endif
  19.  
  20. #ifndef DEFINES_K
  21. #include "Defines.k"
  22. #endif
  23.  
  24. //========================================================================================
  25. // type FW_RRuler
  26. //========================================================================================
  27.  
  28. type FW_RRuler : FW_RSuperView(Label='rulr')
  29. {
  30. };
  31.  
  32. //========================================================================================
  33. // type RDrawView
  34. //========================================================================================
  35.  
  36. type RDrawView : FW_RSuperView(Label='drvw')
  37. {
  38. };
  39.  
  40. //========================================================================================
  41. // resource RDrawFrame(kDrawView)
  42. //========================================================================================
  43. // See constants in "FWViews.k", macros & resource types in "FWViews.fr"
  44.  
  45. // Reference size for the Draw frame (will be adjusted at runtime)
  46. #define H     FW_FIX(1000)
  47. #define H1     H + FW_FIX(1)
  48.  
  49. // Ruler width
  50. #define R     FW_FIX(15)
  51.  
  52. // Drawing extent (sizes defined in Defines.k to be used also in .cpp files)
  53. #define X    FW_FIX(kDrawingSizeX)
  54. #define Y    FW_FIX(kDrawingSizeY)
  55.  
  56. resource FW_RFrameLayout(kDrawView)
  57. {
  58.     {H,H},                    // LayoutSize
  59.     {                        // Start list of frame's subviews
  60.         RDrawView
  61.         (
  62.             kDrawViewID,                        // View id
  63.             {R, R, H-R-FW_SBSIZE, H-R-FW_SBSIZE},// Bounds
  64.             FW_kFitToEnclosure,                    // bindings
  65.             {X,Y},                                // extent
  66.             1,                                    // Make it the ContentView
  67.             FW_kXYScrolling,                    // scrolling flag
  68.             {}                                    // no SubViews
  69.         ),
  70.         FW_RScrollBar            // Horizontal SB
  71.         (
  72.             kHorzScrollBarID,                    // View id
  73.             {-FW_ONE, H-FW_SBSIZE, H1-FW_SBSIZE, H1},// Bounds
  74.             FW_kHScrollBarBinding,                // Standard horizontal SB bindings
  75.             0,                                    // control message
  76.             0,                                    // control receiver
  77.             0,                                    // control value
  78.             0,                                    // SB Min Value (adjusted at runtime)
  79.             1,                                    // SB Max Value (adjusted at runtime)
  80.             FW_ONE,                                // SB Minor Units (adjusted at runtime)
  81.             FW_ONE                                // SB Major Units (adjusted at runtime)
  82.         ),
  83.         FW_RScrollBar            // Vertical SB
  84.         (
  85.             kVertScrollBarID,                    // View id
  86.             {H-FW_SBSIZE,-FW_ONE, H1, H1-FW_SBSIZE},// Bounds
  87.             FW_kVScrollBarBinding,                // Standard vertical SB binding
  88.             0,                                    // control message
  89.             0,                                    // control receiver
  90.             0,                                    // control value
  91.             0,                                    // SB Min Value (adjusted at runtime)
  92.             1,                                    // SB Max Value (adjusted at runtime)
  93.             FW_ONE,                                // SB Minor Units (adjusted at runtime)
  94.             FW_ONE                                // SB Major Units (adjusted at runtime)
  95.         ),
  96.         FW_RGrowBox
  97.         (
  98.             kGrowBoxID,                            // View id
  99.             {H - FW_SBSIZE, H - FW_SBSIZE, H1, H1},    // Bounds
  100.             FW_kGrowBoxBinding                    // standard grow box binding
  101.         ),
  102.         FW_RRuler                // Horizontal ruler
  103.         (
  104.             kHorzRulerID,                        // View id
  105.             {R, 0, H-FW_SBSIZE, R},                // Bounds
  106.             FW_kFixedBounds,                    // bindings
  107.             {X,R},                                // extent
  108.             0,                                    // not the ContentView
  109.             FW_kXScrolling,                        // scrolling flag
  110.             {}                                    // no SubViews
  111.         ),
  112.         FW_RRuler                // Vertical ruler
  113.         (
  114.             kVertRulerID,                        // View id
  115.             {0, R, R, H-FW_SBSIZE},                // Bounds
  116.             FW_kFixedBounds,                    // bindings
  117.             {R,Y},                                // extent
  118.             0,                                    // not the ContentView
  119.             FW_kYScrolling,                        // scrolling flag
  120.             {}                                    // no SubViews
  121.         )
  122.     },
  123.     {                            // Scroller
  124.         FW_RScrollBarScroller
  125.         (
  126.             FW_FIX(15),                            // AutoScrollInset
  127.             {FW_FIX(20), FW_FIX(20)},            // AutoScrollIncrement
  128.             kHorzScrollBarID,                    // horiz sb id
  129.             kVertScrollBarID                    // vertical sb id
  130.         )
  131.     }
  132. };
  133.  
  134. //-------------------------------------------------------------------------------------
  135. //  Duplicate RDrawFrame resource without GrowBox and Scroll-bars for non-root frames
  136. //-------------------------------------------------------------------------------------
  137. // (See also how the Container sample avoids duplicating resources when there are
  138. //  differences between root and non-root frames)
  139.  
  140. resource FW_RFrameLayout(kDrawViewNotRoot)
  141. {
  142.     {H,H},                    // LayoutSize
  143.     {                        // Start list of frame's subviews
  144.         RDrawView
  145.         (
  146.             kDrawViewID,                        // View id
  147.             {R, R, H-R-FW_SBSIZE, H-R-FW_SBSIZE},// Bounds
  148.             FW_kFitToEnclosure,                    // bindings
  149.             {X,Y},                                // extent
  150.             1,                                    // Make it the ContentView
  151.             FW_kXYScrolling,                    // scrolling flag
  152.             {}                                    // no SubViews
  153.         ),
  154.         FW_RRuler                // Horizontal ruler
  155.         (
  156.             kHorzRulerID,                        // View id
  157.             {R, 0, H-FW_SBSIZE, R},                // Bounds
  158.             FW_kFixedBounds,                    // bindings
  159.             {X,R},                                // extent
  160.             0,                                    // not the ContentView
  161.             FW_kXScrolling,                        // scrolling flag
  162.             {}                                    // no SubViews
  163.         ),
  164.         FW_RRuler                // Vertical ruler
  165.         (
  166.             kVertRulerID,                        // View id
  167.             {0, R, R, H-FW_SBSIZE},                // Bounds
  168.             FW_kFixedBounds,                    // bindings
  169.             {R,Y},                                // extent
  170.             0,                                    // not the ContentView
  171.             FW_kYScrolling,                        // scrolling flag
  172.             {}                                    // no SubViews
  173.         )
  174.     },
  175.     {                            // Scroller
  176.         FW_RScrollBarScroller
  177.         (
  178.             FW_FIX(15),                            // AutoScrollInset
  179.             {FW_FIX(20), FW_FIX(20)},            // AutoScrollIncrement
  180.             kHorzScrollBarID,                    // horiz sb id
  181.             kVertScrollBarID                    // vertical sb id
  182.         )
  183.     }
  184. };
  185.